<template>
    <div id="app">
      <button @click="changeLocale('en')">English</button>
      <button @click="changeLocale('zhCHS')">简体中文</button>
      <h3>{{$t("message.hello")}}</h3>
    </div>
</template>

<script>
export default {
  name: 'Hello',
  data () {
    return {
      object: {
        name: '$t("message.hello")',
        url: 'http://www.runoob.com',
        slogan: '学的不仅是技术，更是梦想！'
      }
    }
  },
  methods: {
    changeLocale (lag) {
      // let locale = this.$i18n.locale
      lag === 'en' ? this.$i18n.locale = 'en' : this.$i18n.locale = 'zhCHS'
      console.log(this.$i18n.locale)
      // LangStorage.setLang(this.$i18n.locale) //后面会用做切换和将用户习惯存储到本地浏览器
    }
  }
}
</script>

<style scoped>

</style>
